import numpy as np
import matplotlib.pyplot as plt
import matplotlib.animation as animation

fig, ax = plt.subplots()


POINTS = 60
user = [None] * POINTS
l_user, = ax.plot(range(POINTS), user)


ax.set_ylim(0, 1)
ax.set_xlim(0, 60)


def update(data):
    l_user.set_ydata(data)
    return l_user,


def data_gen():
    while True:
        global user, l_user
        temp = np.random.rand(1)
        user = user[1:] + [temp]
        yield user

ani = animation.FuncAnimation(fig, update, data_gen, interval=1000)
plt.show()

